home *** CD-ROM | disk | FTP | other *** search
- ;-------T-------T------------------------T----------------------------------;
- ;Name: Random Plot
- ;Author: Paul Manias
- ;Copyright: DreamWorld Productions (c) 1996-1997. Freely distributable.
- ;
- ;This is a graphical demonstration of the Random() functions. The default
- ;is to use FastRandom, but you can change it to SlowRandom if you look
- ;below.
- ;
- ;LMB exits.
-
- INCDIR "GMSDev:Includes/"
- INCLUDE "dpkernel/dpkernel.i"
-
- Random = _LVOFastRandom ;_LVOFastRandom() or _LVOSlowRandom().
-
- SECTION "Demo",CODE
-
- ;===========================================================================;
- ; INITIALISE DEMO
- ;===========================================================================;
-
- STARTDPK
-
- Start: MOVEM.L A0-A6/D1-D7,-(SP)
- move.l DPKBase(pc),a6
- lea ScreenTags(pc),a0
- CALL Init
- tst.l d0
- beq.s .Exit
-
- moveq #ID_JOYDATA,d0 ;Get joydata structure.
- CALL Get
- move.l d0,JoyData
- beq.s .Exit
- move.l d0,a0 ;Initialise the joydata structure.
- CALL Init
- tst.l d0
- beq.s .Exit
-
- move.l Screen(pc),a0
- CALL Display
-
- bsr.s Main
-
- .Exit move.l DPKBase(pc),a6
- move.l JoyData(pc),a0
- CALL Free
- move.l Screen(pc),a0
- CALL Free
- MOVEM.L (SP)+,A0-A6/D1-D7
- moveq #ERR_OK,d0
- rts
-
- ;===========================================================================;
- ; MAIN LOOP
- ;===========================================================================;
-
- Main:
- .loop move.l DPKBase(pc),a6
- move.l JoyData(pc),a0
- CALL Query
- move.l JoyData(pc),a0
- move.l JD_Buttons(a0),d0
- btst #JB_LMB,d0
- bne.s .done
-
- move.l Screen(pc),a0
- move.l GS_Bitmap(a0),a1
- move.l BMP_AmtColours(a1),d1 ;Get random colour.
- subq.l #1,d1
- jsr Random(a6) ;>> = Get random number.
- addq.l #1,d0
- move.l d0,d3 ;d3 = Colour to use.
-
- move.w GS_Width(a0),d1 ;Get random X.
- jsr Random(a6) ;>> = Get random number.
- move.w d0,d4 ;d4 = Store X to use.
-
- move.w GS_Height(a0),d1 ;Get random Y.
- jsr Random(a6) ;>> = Get random number.
- move.w d0,d2 ;d2 = Y to use.
- move.w d4,d1 ;d1 = Get back X.
-
- move.l BLTBase(pc),a6
- move.l Screen(pc),a0
- move.l GS_Bitmap(a0),a0
- CALL bltDrawUCPixel
- bra.s .loop
-
- .done rts
-
- ;===========================================================================;
- ; DATA
- ;===========================================================================;
-
- JoyData: dc.l 0
- ScreenTags: dc.l TAGS_SCREEN
- Screen: dc.l 0
- dc.l GSA_Palette,.palette
- dc.l GSA_BitmapTags,0
- dc.l BMA_AmtColours,32
- dc.l TAGEND,0
- dc.l GSA_Width,640
- dc.l GSA_Height,512
- dc.l GSA_ScrMode,HIRES|LACED
- dc.l TAGEND
-
- .palette dc.l PALETTE,32
- dc.l $000000,$109000,$F0C0B0,$F0A090,$D08080,$906050
- dc.l $604040,$201010,$400060,$404040,$F0F000,$403020
- dc.l $C0C000,$109000,$500010,$808000,$206010,$207010
- dc.l $308020,$409020,$50A030,$50B040,$607070,$60C040
- dc.l $708080,$90A0A0,$B0C0C0,$800010,$900010,$A00020
- dc.l $700010,$600010
-
- ;===========================================================================;
-
- ProgName: dc.b "Random Plot",0
- ProgAuthor: dc.b "Paul Manias",0
- ProgDate: dc.b "15 December 1997",0
- ProgCopyright: dc.b "DreamWorld Productions (c) 1996-1997. Freely distributable.",0
- ProgShort: dc.b "Random pixel plotter.",0
- even
-